package com.guodi.model.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guodi.model.entity.CmeDiagnosis;
import com.guodi.model.mapper.CmeDiagnosisMapper;
import com.guodi.model.service.ICmeDiagnosisService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * @描述：诊断分析-关联问题表 服务类
 * @作者: 徐金洲
 * @日期: 2023-05-05
 */
@Service
public class CmeDiagnosisServiceImpl extends ServiceImpl<CmeDiagnosisMapper, CmeDiagnosis> implements ICmeDiagnosisService {

    @Resource
    private CmeDiagnosisMapper cmeDiagnosisMapper;

    @Override
    public List<CmeDiagnosis> getProblemList(String year, String divisionCode) {
        LambdaQueryWrapper<CmeDiagnosis> queryWrapper = (new QueryWrapper()).lambda();
        if (org.apache.commons.lang.StringUtils.isNotBlank(year)) {
            queryWrapper.eq(CmeDiagnosis::getYear, year);
        }
        if (org.apache.commons.lang.StringUtils.isNotBlank(divisionCode)) {
            queryWrapper.eq(CmeDiagnosis::getDivisionCode, divisionCode);
        }
        List<CmeDiagnosis> list = cmeDiagnosisMapper.selectList(queryWrapper);
        return list;
    }
}
